package com.iaiai.imail.util;

import android.content.Context;
import android.os.Environment;

public class Utils {
	
	/**
	 * 判断是否挂载sdcard
	 * @return true挂载，false没有挂载
	 */
	public static boolean isMountSDCard(){
		return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
	}
	
	/**
	 * px像素换算成dip
	 * 
	 * @param context
	 * @param pxValue
	 * @return
	 */
	public static int pxTodip(Context context, float pxValue) {
		return (int) (pxValue / 1.5 + 0.5f);
	}

	/**
	 * dip像素换算成px
	 * 
	 * @param context
	 * @param dipValue
	 * @return
	 */
	public static int dipTopx(Context context, float dipValue) {
		return (int) (dipValue * 1.5 + 0.5f);
	}

}
